from django.contrib import admin

# Register your models here.



from .models import *


class ServiceGroupAdmin(admin.ModelAdmin):
    list_display = ['id','name','desc']

class ServiceAdmin(admin.ModelAdmin):
    raw_id_fields = ['group']
    list_display=['id','group_name','name','desc']

    # list_editable = ['group_name','name','desc']

    def group_name(self,obj):
        return obj.group.name



class DeviceAdmin(admin.ModelAdmin):
    list_display = ['id','sn']

class AbhostAdmin(admin.ModelAdmin):
    list_display = ['id','env','host','desc']



admin.site.register(ServiceGroup,ServiceGroupAdmin)
admin.site.register(Device,DeviceAdmin)
admin.site.register(Service,ServiceAdmin)
admin.site.register(Abhost,AbhostAdmin)